package filterMusic.filter;

import java.io.IOException;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public abstract class HttpFilter implements Filter {

	private FilterConfig filterConfig;
	
	@Override
	public void destroy() {
		// TODO Auto-generated method stub

	}

	@Override
	public void doFilter(ServletRequest arg0, ServletResponse arg1, FilterChain arg2)
			throws IOException, ServletException {
		// TODO Auto-generated method stub

		HttpServletRequest reqeust=(HttpServletRequest) arg0;
		HttpServletResponse response=(HttpServletResponse) arg1;
		arg2.doFilter(reqeust, response);
		
		
	}

	public abstract void doFilter(HttpServletRequest request,HttpServletResponse response,FilterChain filterChain)
	throws IOException , ServletException;
	
	@Override
	public void init(FilterConfig arg0) throws ServletException {
		// TODO Auto-generated method stub

		 this.filterConfig=arg0;
		 init();
	}
	
	protected void init(){}
	
	public FilterConfig getFilterConfig(){
		return filterConfig;
	}

}
